//存储数据
export const setItem = (key:string,value:unknown) => {
    if(typeof value == "object"){
        value = JSON.stringify(value);
    }
    window.localStorage.setItem(key,value as string)
}
//获取数据
export const getItem = (key:string) =>{
    const data = window.localStorage.getItem(key);
    try{
        return JSON.parse(data as string);
    }catch(e){
        return data;
    }
};
//删除数据
export const removeItem = (key:string) =>{
    window.localStorage.removeItem(key);
}
